package com.wolf.util.http;

import org.apache.http.entity.ContentType;
import org.apache.http.impl.cookie.BasicClientCookie;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author sdyang
 * @create 2019-05-21 15:42
 **/
public class HttpRequestParam {

    private String charset = "UTF-8";

    private ContentType contentType = ContentType.APPLICATION_JSON;

    private String url;

    private String data;

    private Map<String, Object> paramMap = new HashMap<String, Object>();

    private List<BasicClientCookie> cookies = new ArrayList<BasicClientCookie>();

    private Map<String, String> headMap = new HashMap<String, String>();

    public static HttpRequestParam getInstance() {
        return new HttpRequestParam();
    }

    public void addParam(String key, Object value) {
        paramMap.put(key, value);
    }

    public void addCookie(BasicClientCookie cookie) {
        cookies.add(cookie);
    }

    public void addCookie(String key, Object value) {
        BasicClientCookie cookie = new BasicClientCookie(key, value.toString());
        cookies.add(cookie);
    }

    public void addHeadParam(String key, String value) {
        headMap.put(key, value);
    }

    public ContentType getContentType() {
        return contentType;
    }

    public void setContentType(ContentType contentType) {
        this.contentType = contentType;
    }

    public String getCharset() {
        return charset;
    }

    public void setCharset(String charset) {
        this.charset = charset;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public Map<String, Object> getParamMap() {
        return paramMap;
    }

    public void setParamMap(Map<String, Object> paramMap) {
        this.paramMap = paramMap;
    }

    public List<BasicClientCookie> getCookies() {
        return cookies;
    }

    public void setCookies(List<BasicClientCookie> cookies) {
        this.cookies = cookies;
    }

    public Map<String, String> getHeadMap() {
        return headMap;
    }

    public void setHeadMap(Map<String, String> headMap) {
        this.headMap = headMap;
    }
}
